package com.sky.mapper;

import com.sky.dto.AddressBookDTO;
import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * PROJECT_NAME: sky-take-out
 * NAME: AddressBookMapper
 *
 * @AUTHOR: zhang
 * DATE: 2023/12/1
 * DESCRIPTION :
 */
@Mapper
public interface AddressBookMapper {
    /**
     * 查询地址列表
     * @param addressBook
     * @return
     */
    List<AddressBook> selectAddressBook(@Param("addressBook") AddressBook addressBook);

    /**
     * 新增地址
     * @param addressBook
     */
    void insertAddressBook(@Param("addressBook") AddressBook addressBook);

    /**
     * 修改地址信息
     * @param addressBook
     */
    void upadte(@Param("addressBook") AddressBook addressBook);

    /**
     * 根据当前用户先把所有的默认地址修改为0(未设置)
     * @param book
     */
    void updateISDefaultByuserId(@Param("book") AddressBook book);

    /**
     * 根据地址id查询地址
     * @param id
     * @return
     */
    AddressBook selectAddressBookById(@Param("id") Long id);


    void deleteAddressById(@Param("id") Long id);

    AddressBook getDefaultAddressBook();

}
